﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Shared
{
    [DataContract]
    public class Register
    {
        [DataMember]
        public DateTime TimeStamp{ get; set; }

        [DataMember]
        public RegisterState State { get; set; }

        [DataMember]
        public string Identity { get; set; }

        [DataMember]
        public int RequestType { get; set; }

        //Personal
        [DataMember]
        public string PersonalName { get; set; }

        [DataMember]
        public string PersonalLastName { get; set; }

        [DataMember]
        public string PersonalFullName { get; set; }

        [DataMember]
        public string ActualId { get; set; }

        [DataMember]
        public string MelliCode { get; set; }

        [DataMember]
        public string BirthDate { get; set; }

        [DataMember]
        public string ActualIssue { get; set; }

        [DataMember]
        public string FatherName { get; set; }

        [DataMember]
        public string ActualEmploy { get; set; }

        [DataMember]
        public int ManagerGrade { get; set; }

        [DataMember]
        public string ActualMajor { get; set; }
        
        [DataMember]
        public bool ActualHighSpeed { get; set; }

        [DataMember]
        public int ActualMadarek { get; set; }

        //Company
        [DataMember]
        public string CompanyName { get; set; }

        [DataMember]
        public string CompanyFullName { get; set; }

        [DataMember]
        public string RegNo { get; set; }

        [DataMember]
        public string Economics { get; set; }

        [DataMember]
        public string ManagerName { get; set; }

        [DataMember]
        public string ManagerLastName { get; set; }

        [DataMember]
        public string ManagerFullname { get; set; }

        [DataMember]
        public string ManagerMelliCode { get; set; }

        [DataMember]
        public string ManagerBirthDate { get; set; }

        [DataMember]
        public int CompanyManagerGrade { get; set; }

        [DataMember]
        public string ManagerMajor { get; set; }

        [DataMember]
        public string CompanyBaseActivity { get; set; }

        //Address
        [DataMember]
        public string Address { get; set; }

        [DataMember]
        public string PostalCode { get; set; }

        [DataMember]
        public string Tel { get; set; }

        [DataMember]
        public string Mobile { get; set; }

        [DataMember]
        public string Fax { get; set; }

        [DataMember]
        public string Email { get; set; }

        [DataMember]
        public string Webiste { get; set; }

        [DataMember]
        public int Region { get; set; }

        [DataMember]
        public int City { get; set; }

        //Place
        [DataMember]
        public string AddressModem { get; set; }

        [DataMember]
        public string Plaque { get; set; }

        [DataMember]
        public string BuilidingName { get; set; }

        [DataMember]
        public string PlaceFloor { get; set; }

        [DataMember]
        public string PlaceVahedNum { get; set; }

        [DataMember]
        public string PlaceTelNum { get; set; }

        [DataMember]
        public int PlaceOstan { get; set; }

        [DataMember]
        public int PlaceCity { get; set; }

        //Service
        [DataMember]
        public string ProductTitle { get; set; }

        [DataMember]
        public int ServiceDuration { get; set; }

        [DataMember]
        public int OrderId { get; set; }

        public Register()
        {
            TimeStamp = DateTime.Now;
            State = RegisterState.Started;
        }

        public string ToCSV()
        {
            string seperator = ",";
            string result = String.Empty;

            result +=
                TimeStamp.ToString() + seperator +
                State.ToString() + seperator +
                Identity.ToString() + seperator +
                RequestType.ToString() + seperator +
                PersonalName.ToString() + seperator +
                PersonalLastName.ToString() + seperator +
                PersonalFullName.ToString() + seperator +
                ActualId.ToString() + seperator +
                MelliCode.ToString() + seperator +
                BirthDate.ToString() + seperator +
                ActualIssue.ToString() + seperator +
                FatherName.ToString() + seperator +
                ActualEmploy.ToString() + seperator +
                ManagerGrade.ToString() + seperator +
                ActualMajor.ToString() + seperator +
                CompanyName.ToString() + seperator +
                CompanyFullName.ToString() + seperator +
                RegNo.ToString() + seperator +
                Economics.ToString() + seperator +
                ManagerName.ToString() + seperator +
                ManagerMelliCode.ToString() + seperator +
                ManagerLastName.ToString() + seperator +
                ManagerFullname.ToString() + seperator +
                ManagerBirthDate.ToString() + seperator +
                ManagerMajor.ToString() + seperator +
                CompanyBaseActivity.ToString() + seperator +
                CompanyManagerGrade.ToString() + seperator +
                Address.ToString() + seperator +
                PostalCode.ToString() + seperator +
                Tel.ToString() + seperator +
                Mobile.ToString() + seperator +
                Fax.ToString() + seperator +
                Email.ToString() + seperator +
                Webiste.ToString() + seperator +
                AddressModem.ToString() + seperator +
                Plaque.ToString() + seperator +
                BuilidingName.ToString() + seperator +
                PlaceFloor.ToString() + seperator +
                PlaceVahedNum.ToString() + seperator +
                PlaceTelNum.ToString() + seperator +
                PlaceOstan.ToString() + seperator +
                PlaceCity.ToString() + seperator +
                ProductTitle.ToString() + seperator +
                ServiceDuration.ToString();


            return result;
        }

        public string PrintHeader()
        {
            string result = String.Empty;
            result +=
                "Timestamp," +
                "State," + 
                "Identity," + 
                "RequestType," + 
                "PersonalName," + 
                "PersonalLastName," + 
                "PersonalFullName," + 
                "ActualId," + 
                "MelliCode," + 
                "BirthDate," + 
                "ActualIssue," + 
                "FatherName," + 
                "ActualEmploy," + 
                "ManagerGrade," + 
                "ActualMajor," + 
                "CompanyName," + 
                "CompanyFullName," + 
                "RegNo," + 
                "Economics," + 
                "ManagerName," + 
                "ManagerMelliCode," + 
                "ManagerLastName," + 
                "ManagerFullname," + 
                "ManagerBirthDate," + 
                "ManagerMajor," + 
                "CompanyBaseActivity," + 
                "CompanyManagerGrade," + 
                "Address," + 
                "PostalCode," + 
                "Tel," + 
                "Mobile," + 
                "Fax," + 
                "Email," + 
                "Webiste," + 
                "AddressModem," + 
                "Plaque," + 
                "BuilidingName," + 
                "PlaceFloor," + 
                "PlaceVahedNum," + 
                "PlaceTelNum," + 
                "PlaceOstan," + 
                "PlaceCity," + 
                "ProductTitle," + 
                "ServiceDuration," + 
                Environment.NewLine;

            return result;
        }

        public override string ToString()
        {
            string result = String.Empty;

            result +=
                "Timestamp: " + TimeStamp.ToString() + Environment.NewLine +
                "State: " + State.ToString() + Environment.NewLine +
                "Identity: " + Identity.ToString() + Environment.NewLine +
                "RequestType: " + RequestType.ToString() + Environment.NewLine +
                (RequestType == 1 ? ("PersonalName: " + PersonalName + Environment.NewLine) : String.Empty) +
                (RequestType == 1 ? ("PersonalLastName: " + PersonalLastName + Environment.NewLine) : String.Empty) +
                (RequestType == 1 ? ("PersonalFullName: " + PersonalFullName + Environment.NewLine) : String.Empty) +
                (RequestType == 1 ? ("ActualId: " + ActualId + Environment.NewLine) : String.Empty)  +
                (RequestType == 1 ? ("MelliCode: " + MelliCode + Environment.NewLine) : String.Empty)  +
                (RequestType == 1 ? ("BirthDate: " + BirthDate + Environment.NewLine) : String.Empty)  +
                (RequestType == 1 ? ("ActualIssue: " + ActualIssue + Environment.NewLine) : String.Empty)  +
                (RequestType == 1 ? ("FatherName: " + FatherName + Environment.NewLine) : String.Empty)  +
                (RequestType == 1 ? ("ActualEmploy: " + ActualEmploy + Environment.NewLine) : String.Empty)  +
                
                (RequestType == 1 ? ("ActualMajor: " + ActualMajor + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("CompanyName: " + CompanyName + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("CompanyFullName: " + CompanyFullName + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("RegNo: " + RegNo + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("Economics: " + Economics + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("ManagerName: " + ManagerName + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("ManagerMelliCode: " + ManagerMelliCode + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("ManagerLastName: " + ManagerLastName + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("ManagerFullname: " + ManagerFullname + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("ManagerBirthDate: " + ManagerBirthDate + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("ManagerMajor: " + ManagerMajor + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("ManagerGrade: " + ManagerGrade.ToString() + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("CompanyBaseActivity: " + CompanyBaseActivity + Environment.NewLine) : String.Empty) +
                (RequestType == 2 ? ("CompanyManagerGrade: " + CompanyManagerGrade + Environment.NewLine) : String.Empty) +
                "Address: " + Address + Environment.NewLine +
                "PostalCode: " + PostalCode + Environment.NewLine +
                "Tel: " + Tel + Environment.NewLine +
                "Mobile: " + Mobile + Environment.NewLine +
                "Fax: " + Fax + Environment.NewLine +
                "Email: " + Email + Environment.NewLine +
                "Webiste: " + Webiste + Environment.NewLine +
                "AddressModem: " + AddressModem + Environment.NewLine +
                "Plaque: " + Plaque + Environment.NewLine +
                "BuilidingName: " + BuilidingName + Environment.NewLine +
                "PlaceFloor: " + PlaceFloor + Environment.NewLine +
                "PlaceVahedNum: " + PlaceVahedNum + Environment.NewLine +
                "PlaceTelNum: " + PlaceTelNum + Environment.NewLine +
                "PlaceOstan: " + PlaceOstan.ToString() + Environment.NewLine +
                "PlaceCity: " + PlaceCity.ToString() + Environment.NewLine +
                "ProductTitle: " + ProductTitle + Environment.NewLine +
                "ServiceDuration: " + ServiceDuration.ToString() + Environment.NewLine +
                Environment.NewLine;


            return result;
        } 

    }

  
}
